# Button 按钮
# 基础用法
MillButton(
onPressed: onPressed,
child: Text('确定'),
),
# 设置类型
通过 type 字段设置类型, warning,error,primary。
MillButton(
type: 'primary',
onPressed: onPressed,
child: Text('确定'),
),
MillButton(
type: 'warning',
onPressed: onPressed,
child: Text('确定'),
),
MillButton(
type: 'error',
onPressed: onPressed,
child: Text('确定'),
),
# 自定义颜色
MillButton(
textColor: Color(0xffffffff),
color: Color(0xff67C23A),
highlightColor: Color(0xff67D033),
onPressed: onPressed,
child: Text('确定'),
),
# 朴素模式
MillButton(
onPressed: onPressed,
child: Text('确定'),
plain: true,
),
MillButton(
type: 'warning',
onPressed: onPressed,
child: Text('确定'),
plain: true,
),
MillButton(
type: 'error',
onPressed: onPressed,
child: Text('确定'),
plain: true,
),
MillButton(
radius: 40,
onPressed: onPressed,
child: Text('确定'),
plain: true,
),
# 渐变
MillButton(
radius: 40,
onPressed: onPressed,
child: Text('确定'),
gradient: LinearGradient(
colors: [Color(0xff5775f4), Color(0xff3555de)]),
),
# 禁用状态
MillButton(
onPressed: onPressed,
child: Text('确定'),
disabled: true,
),
MillButton(
type: 'warning',
onPressed: onPressed,
child: Text('确定'),
disabled: true,
),
MillButton(
type: 'error',
onPressed: onPressed,
child: Text('确定'),
disabled: true,
),
MillButton(
onPressed: onPressed,
child: Text('确定'),
disabled: true,
plain: true,
),
MillButton(
type: 'warning',
onPressed: onPressed,
child: Text('确定'),
plain: true,
disabled: true,
),
MillButton(
type: 'error',
child: Text('确定'),
plain: true,
),
# Attributes
字段名称 | 说明 | 类型 | 默认值 |
---|---|---|---|
type | 按钮的类型。warning,error,primary | String | primary |
child | 按钮子元素 | Widget | |
textColor | 字体颜色 | Color | |
color | 背景颜色 | Color | |
highlightColor | 点击高亮色 | Color | |
disabledColor | disabled 颜色 | Color | |
disabledTextColor | disabled 字体颜色 | Color | |
disabledBorderColor | disabled 边框颜色 | Color | |
borderColor | 边框颜色 | Color | |
plain | 简单模式 | bool | false |
radius | 圆角 | double | 5 |
gradient | 渐变 | Gradient | |
height | 高度 | double | 36 |
disabled | 禁用 | bool | false |
onPressed | 单次点击事件 | Function |
← Loading 加载中 Toast 轻提示 →